{:W('Template/top')}
<div class="wrapper clearfix content" style="position: relative;border: 1px solid #ddd">
    {:W('Template/left')}
    <div class="rightbox pull-right">
        <input id="status" type='hidden' value='{$state}'/>
        <input id="chkState" type="hidden" value="{:U('Withdraw/providerAuditWithDraw')}"/>
        <input id="chkStatePass" type="hidden" value="{:U('Withdraw/financeAuditWithDraw')}"/>
        <input id="showAccountBalance" type="hidden" value="{:U('Withdraw/showAccountBalance')}"/>
        <input type="hidden" id="showFullName" value="{:U('Withdraw/showFullName')}">
        <input type="hidden" id="code" value="{$Think.session.providerWithdrawCode}">
        <input type="hidden" id="showProof" value="{:U('Agency/showProofInfo')}">
        <input type="hidden" id="invoiceList" value="{:U('Withdraw/updateWithDrawProof')}">

        <div class="ur-here">您当前的位置：<a href="#">供应商管理</a>&gt;提现申请</div>
        <div class="cTitle2">提现申请</div>
        <div class="main-search">
            <div class="top clearfix">
                <form method="get" action="{:U('Withdraw/index',array('id'=>I('get.id')))}" class="form-inline">
                    <input type="hidden" name="state" value="{$state}">

                    <div class="form-group">
                        <input type="text" class="form-control" name="names" placeholder="供应商简称/全称/提现金额" value="{$name}"
                               style="width:200px;"/>
                    </div>
                    <div class="form-group ml">
                        <label>时间：</label>
                        <input type="text" class="form-control ui-datepicker Wdate" name="start_time" placeholder="开始日期"
                               value="{$startTime}" id="d4322" onclick="WdatePicker({el: $dp.$('d12')})"
                               style="width:80%">
                    </div>
                    <span class="end">到</span>

                    <div class="form-group">
                        <label class="sr-only"></label>
                        <input type="text" class="form-control ui-datepicker Wdate" name="end_time" placeholder="结束日期"
                               value="{$endTime}" id="d4322" onclick="WdatePicker({el: $dp.$('d12')})">
                    </div>
                    <button type="submit" class="btn btn-warning">查询</button>
                    <span style="font-size: 16px;" class='text-c1'>(查询金额时，请以“分”为单位查询)</span>
                </form>
            </div>
            <p></p>

            <form method="post" action="{:U('GetApplyExcel/getProviderWithDrawExcel',array('id' => I('get.id')))}">
                <input type="hidden" name="sname" value="{$name}">
                <input type="hidden" name="start_time" value="{$startTime}">
                <input type="hidden" name="end_time" value="{$endTime}">
                <input type="hidden" name="state" value="{$state}">
                <input type="submit" class="btn btn-success" value="导出生成Excel">
            </form>
            <div class="status">
                <if condition="$Think.session.role_id neq 185">
                    <label>状态：</label>
                    <a class="nav-audit-state nav-audit-state0"
                       href="{:U('Withdraw/index',array('state'=>0,'id'=>I('get.id')))}">全部
                        <if condition="$state eq 0">({$total})</if>
                    </a>
                    <a class="nav-audit-state nav-audit-state1"
                       href="{:U('Withdraw/index',array('state'=>1,'id'=>I('get.id')))}">待审核
                        <if condition="$state eq 1">({$total})</if>
                    </a>
                    <a class="nav-audit-state nav-audit-state2"
                       href="{:U('Withdraw/index',array('state'=>2,'id'=>I('get.id')))}">待财务处理
                        <if condition="$state eq 2">({$total})</if>
                    </a>
                    <a class="nav-audit-state nav-audit-state4"
                       href="{:U('Withdraw/index',array('state'=>4,'id'=>I('get.id')))}">处理完成
                        <if condition="$state eq 4">({$total})</if>
                    </a>
                    <a class="nav-audit-state nav-audit-state3"
                       href="{:U('Withdraw/index',array('state'=>3,'id'=>I('get.id')))}">拒绝
                        <if condition="$state eq 3">({$total})</if>
                    </a>

                    <elseif condition="$Think.session.role_id eq 185"/>
                    <label>状态：</label>
                    <a class="nav-audit-state nav-audit-state2"
                       href="{:U('Withdraw/index',array('state'=>2,'id'=>I('get.id')))}">待财务处理
                        <if condition="$state eq 2">({$total})</if>
                    </a>
                    <a class="nav-audit-state nav-audit-state4"
                       href="{:U('Withdraw/index',array('state'=>4,'id'=>I('get.id')))}">处理完成
                        <if condition="$state eq 4">({$total})</if>
                    </a>
                </if>
            </div>
        </div>

        <table class="cTable table-hover" width="100%">
            <tr>
                <th width="8%">编号</th>
                <th width="10%">供应商</th>
                <th width="10%">所属运营商</th>
                <th width="10%">提现金额</th>
                <th width="8%">提现周期</th>
                <th width="10%">账户总额</th>
                <th width="8%">提现帐户</th>
                <th width="9%">申请时间</th>
                <th width="9%">审核时间</th>
                <th width="8%">凭证</th>
                <th width="10%">状态</th>
                <th width="8%">操作</th>
            </tr>
            <volist name='info' id='v'>
                <if condition="($Think.session.role_id neq 185) && ($Think.session.role_id neq 1)">
                    <tr>
                        <td>{$v.id}</td>
                        <td class="tl">
                            <a href="javascript:void(0)" onclick="showFullName({$v.entity_id}, {$v.id})"
                               class="text-c5 showFullName{$v.id}">
                                {$v.entity_name}
                            </a>
                            <span style="display: none" class="fullName{$v.id}"></span>
                        </td>
                        <td>{$v.operator_id|getOperatorName}</td>
                        <td class="text-c1"> &yen;{$v.amount|GetYuan}</td>
                        <td class="text-c1">
                            <if condition="$v['settlement_interval'] eq 0">
                                <else/>
                                T+{$v.settlement_interval}
                            </if>
                        </td>
                        <td>
                            <a href="javascript:void(0)"
                               onclick="showAccountBalance({$v.entity_id}, {$v.id}, {$v.operator_id})"
                               class="text-c5 showAccountBalance{$v.id}">查看</a>
                            <span style="display: none" class="showBalance{$v.id}"></span>
                        </td>
                        <td>{$v.bank_name}<br/>账号 {$v.bank_account}</td>
                        <td>{$v.create_time}</td>
                        <td>{$v.update_time}</td>
                        <td class="text-c1">{$v.proof_type} {$v.proof_code}</td>
                        <td class="text-c3">
                            <if condition="$v.state eq 1">
                                <span style="color:saddlebrown">待审核</span>
                                <elseif condition="$v.state eq 2"/>
                                <span class="text-c6">已收发票，待财务处理</span>
                                <elseif condition="$v.state eq 4"/>
                                <span class="text-c7">处理完成</span>
                                <else/>
                                <a href="javascript:void(0)" data-toggle="tooltip" data-placement="top"
                                   title="{$v.memo}" style="text-decoration: none"><span class="text-c8">拒绝</span></a>
                            </if>
                        </td>

                        <td>
                            <if condition="$v['state'] eq 1">
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default dropdown-toggle"
                                            data-toggle="dropdown" aria-expanded="false">
                                        操作<span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li>
                                            <a onclick="changeWithDrawState({$v.id}, '{$v.id|setEncrypt}', {:Common\\Top::ApplyStatePass}, {$v.entity_id|getProviderState}, {$v.entity_id|getProviderAccountState})"
                                               style="cursor: pointer">已收发票，待财务处理</a></li>
                                        <li>
                                            <a onclick="providerWithDrawReject({$v.id}, '{$v.id|setEncrypt}', {:Common\\Top::ApplyStateReject})"
                                               style="cursor: pointer">拒绝</a></li>
                                    </ul>
                                </div>
                                <elseif condition="$v['state'] eq 2"/>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default dropdown-toggle"
                                            data-toggle="dropdown" aria-expanded="false">
                                        操作<span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li>
                                            <a onclick="providerWithDrawReject({$v.id}, '{$v.id|setEncrypt}', {:Common\\Top::ApplyStateReject})"
                                               style="cursor: pointer">拒绝</a></li>
                                    </ul>
                                </div>
                                <else/>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default dropdown-toggle"
                                            data-toggle="dropdown" aria-expanded="false">
                                        操作<span class="caret"></span>
                                    </button>
                                </div>
                            </if>
                        </td>
                    </tr>
                </if>
                <if condition="($Think.session.role_id eq 1) or ($Think.session.role_id eq 185)">
                    <if condition="$v['state'] eq 2 or $v['state'] eq 4">
                        <tr>
                            <td>{$v.id}</td>
                            <td class="tl">
                                <a href="javascript:void(0)" onclick="showFullName({$v.entity_id}, {$v.id})"
                                   class="text-c5 showFullName{$v.id}">
                                    {$v.entity_name}
                                </a>
                                <span style="display: none" class="fullName{$v.id}"></span>
                            </td>
                            <td>{$v.operator_id|getOperatorName}</td>
                            <td class="text-c1"> &yen;{$v.amount|GetYuan}</td>
                            <td class="text-c1">
                                <if condition="$v['settlement_interval'] eq 0">
                                    <else/>
                                    T+{$v.settlement_interval}
                                </if>
                            </td>
                            <td>
                                <a href="javascript:void(0)"
                                   onclick="showAccountBalance({$v.entity_id}, {$v.id}, {$v.operator_id})"
                                   class="text-c5 showAccountBalance{$v.id}">查看</a>
                                <span style="display: none" class="showBalance{$v.id}"></span>
                            </td>
                            <td>{$v.bank_name}<br/>账号 {$v.bank_account}</td>
                            <td>{$v.create_time}</td>
                            <td>{$v.update_time}</td>
                            <td class="text-c1">{$v.proof_type} {$v.proof_code}</td>
                            <td class="text-c3">
                                <if condition="$v.state eq 1">
                                    <span style="color:saddlebrown">待审核</span>
                                    <elseif condition="$v.state eq 2"/>
                                    <span class="text-c6">已收发票，待财务处理</span>
                                    <elseif condition="$v.state eq 4"/>
                                    <span class="text-c7">处理完成</span>
                                    <else/>
                                    <a href="javascript:void(0)" data-toggle="tooltip" data-placement="top"
                                       title="{$v.memo}" style="text-decoration: none"><span
                                            class="text-c8">拒绝</span></a>
                                </if>
                            </td>

                            <td>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default dropdown-toggle"
                                            data-toggle="dropdown" aria-expanded="false">
                                        操作<span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <if condition="$v['state'] eq 2">
                                            <li>
                                                <a href="javascript:void(0)"
                                                   onclick="changeProviderWithdrawState({$v.id}, '{$v.id|setEncrypt}', {:Common\\Top::ApplyStateFinish}, {$v.entity_id|getProviderState}, {$v.entity_id|getProviderAccountState})">处理完成</a>
                                            </li>
                                            <elseif condition="$v['state'] eq 4"/>
                                            <li>
                                                <a href="javascript:void(0)"
                                                   onclick="updateProof({$v.id}, '{$v.id|setEncrypt}', {$v.state}, 2)">更新凭证</a>
                                            </li>
                                        </if>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                    </if>
                </if>
            </volist>
        </table>
        <notempty name="info">
            <div class="pagebox">
                {$page}
            </div>
        </notempty>
    </div>
</div>
<div class="theme-popover">
    <div class="theme-poptit">
        <a title="关闭" class="closes">&times;</a>

        <div class="modal-header">
            <h4 class="modal-title" id="myModalLabel">拒绝理由</h4>
        </div>
        <div class="modal-body" id="modal_reject">
            <textarea class="form-control" name="reason" style="resize: none;" placeholder="请填写拒绝理由"></textarea>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-warning" id="button">确定</button>
            <button type="button" class="btn btn-default " id="reset">取消</button>
        </div>
    </div>
</div>
<div class="theme-popover-mask"></div>

<div class="modal fade" id="myModalEdit" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:300px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    填写凭证信息
                </h4>
            </div>
            <div class="modal-body">
                凭证类型：
                <input type="text" class="proof_type form-control" style="border:1px solid #e5e5e5">

                <p>
                    凭证号码：
                    <input type="text" class="proof_code form-control" style='border:1px solid #e5e5e5'>

                <p>
            </div>
            <div class="modal-footer">
                <div class="pull-right">
                    <button type="button" class="btn btn-primary doSubmitTopup">
                        确定
                    </button>
                    <button type="button" class="btn btn-default cancel"
                            data-dismiss="modal">关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
{:W('Template/bottom')}
<script>
    $(function () {
        $("[data-toggle='tooltip']").tooltip();
    });
</script>
</body>
</html>
